Skip to content

feat: SDK update for version 22.1.0#325

Merged
ChiragAgg5k merged 2 commits into
masterfrom
dev
Jun 19, 2026
Merged

feat: SDK update for version 22.1.0#325
ChiragAgg5k merged 2 commits into
masterfrom
dev

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Jun 19, 2026

Copy link
Copy Markdown
Member

This PR contains updates to the SDK for version 22.1.0.

What's Changed

  • Fixed: organization get-invoice-download and get-invoice-view now save the invoice to disk via --destination
  • Fixed: File download commands now report a clear error when the download request fails
  • Added: oauth2 command group (authorize, create-token, create-grant, get-grant, approve, reject, revoke, logout, create-device-authorization)
  • Added: messaging create-ses-provider and update-ses-provider commands for Amazon SES
  • Added: project update-o-auth-2-server command to configure the OIDC provider
  • Added: project update-deny-corporate-email-policy command
  • Added: project update-password-strength-policy command
  • Added: --dedicated-database-id option to tables-db create
  • Updated: Bumped @appwrite.io/console dependency to ^15.0.0

@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 22.1.0 feat: SDK update for version 22.1.0 Jun 19, 2026
@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR bumps the CLI to v22.1.0 and ships three main changes: OAuth2 device-flow login (behind the APPWRITE_CLI_OAUTH_LOGIN flag), new service commands (Amazon SES provider, OAuth2 server, several project policies), and a large refactoring that splits the monolithic login/session logic in generic.ts into focused lib/auth/ modules.

  • Auth refactor: login.ts, session.ts, and oauth.ts replace the inline implementations in generic.ts. Token refresh logic is added to sdks.ts via getValidAccessToken, and the tokenExpiry === 0 && !refreshToken fast-path correctly handles configs where expiry was never persisted.
  • New commands: oauth-2 subcommands expose the Appwrite OAuth2 server (device auth, grant lifecycle, token exchange, revocation); messaging create-ses-provider / update-ses-provider follow the existing provider pattern; three new project-policy commands and a new --user-accessed-at option for membership privacy are added.
  • Invoice download fix: organizations get-invoice-download and get-invoice-view now accept --destination, check response.ok, and write the buffer to disk — addressing the previously flagged missing response-status check.

Confidence Score: 5/5

Safe to merge; the core login/session refactor is well-structured, all callers restore session state correctly after logout, and previously flagged issues have been addressed.

The auth refactoring correctly delegates to focused modules without introducing regressions in the logout flow. The logoutSessions function has an unnecessary setCurrentSession side-effect inside its loop, but every call site restores the current session afterward so no functional breakage occurs. The new oauth-2 commands have a UX quirk with underscore-embedded option names and expose client secrets as CLI arguments, but neither causes incorrect behavior.

lib/commands/services/oauth-2.ts warrants a second look for the option-naming convention and secret-handling approach before wider rollout.

Security Review

  • Client secret in process table (lib/commands/services/oauth-2.ts): --client-_secret in the revoke and create-token subcommands passes a confidential OAuth2 app secret as a plain CLI argument, making it visible in ps aux / /proc/<pid>/cmdline and shell history on shared systems. An environment-variable fallback would mitigate this for production use.

Important Files Changed

Filename Overview
lib/auth/login.ts New file: extracts login logic from generic.ts, adds OAuth2 device-flow path controlled by the oauthLogin feature flag; error recovery and session cleanup on failure are handled correctly.
lib/auth/oauth.ts New file: implements RFC 8628 device-code polling with correct slow_down back-off, safe base64url ID-token decode, and refresh-token revocation helper.
lib/auth/session.ts New file: session management helpers; logoutSessions unnecessarily mutates currentSession inside the loop as a leftover from the old implementation, though all current callers restore it afterward.
lib/commands/generic.ts Refactored: login/logout/session logic delegated to auth/* modules; whoami check upgraded from cookie-only to hasAuthSession(); logic is correct.
lib/sdks.ts Added getValidAccessToken with token-refresh logic; the tokenExpiry===0 fast-path correctly allows use of a token whose expiry was never persisted.
lib/commands/services/oauth-2.ts New file: OAuth2 CLI commands; --grant-_id style option names are unusual and unintuitive; --client-_secret is passed as a plain CLI argument, exposing it in process tables.
lib/commands/services/messaging.ts Added create-ses-provider and update-ses-provider commands following the existing provider pattern; no issues.
lib/commands/services/organizations.ts Invoice download/view commands now accept --destination, fetch the URL, check response.ok, and write the buffer to disk.
lib/commands/services/project.ts Added update-o-auth-2-server, update-deny-corporate-email-policy, update-password-strength-policy, and --user-accessed-at option; policy/service ID lists updated correctly.
lib/flags.ts New file: central feature-flag registry gating oauthLogin and devCloudLogin via environment variables; clean implementation.
lib/commands/push.ts Added getConsoleUrlProjectRegion with per-project caching to build correct console URLs for function/site deployments.

Reviews (2): Last reviewed commit: "chore: update Command Line SDK to 22.1.0" | Re-trigger Greptile

Comment thread lib/commands/services/organizations.ts
Comment thread lib/commands/services/organizations.ts
Comment thread lib/auth/login.ts Outdated
Comment thread lib/sdks.ts
@ChiragAgg5k ChiragAgg5k changed the title feat: SDK update for version 22.1.0 feat: Command Line SDK update for version 22.1.0 Jun 19, 2026
@ChiragAgg5k ChiragAgg5k changed the title feat: Command Line SDK update for version 22.1.0 feat: SDK update for version 22.1.0 Jun 19, 2026
@ChiragAgg5k ChiragAgg5k merged commit b9fe809 into master Jun 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants